package Lee_code;

public class Lee_459
{
    public boolean repeatedSubstringPattern(String s)
    {
        int len = s.length();
        for(int i=2; i<=len/2; i++)
        {
            if(len%i!=0)
            {
                i++;
            }
            else
            {
                String sub = s.substring(0,i);
                if(if_contain(sub,s,i))
                {
                    return true;
                }
            }
        }
        return false;
    }
    public boolean if_contain(String sub_len, String s, int start)
    {
        for(int i=start; i<s.length(); i=i+sub_len.length())
        {
            if(!s.startsWith(sub_len, i))
                return false;
        }
        return true;
    }
}
